﻿package mortal.game.view.heroArena.view
{
    import Message.Public.*;
    import extend.language.*;
    import fl.data.*;
    import mortal.game.mvc.*;
    import mortal.game.view.arena.data.*;
    import mortal.game.view.arena.util.*;
    import mortal.mvc.core.*;

    public class HeroArenaCurrHistRankPanel extends HeroArenaRankPanelBase
    {

        public function HeroArenaCurrHistRankPanel()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            _title1.text = Language.getString(41540);
            _title1.x = 679 + 11 - 8;
            _title2.text = Language.getString(41541);
            _title2.x = 799 + 11;
            _introduceSpr.visible = true;
            this.addListeners();
            this.requestRankInfo();
            return;
        }// end function

        private function requestRankInfo() : void
        {
            GameProxy.copy.getArenaToplist(ECopyType._ECopyTypeArena2v2, ArenaConst.Type_ArenaRank_CurrServerHist);
            return;
        }// end function

        private function addListeners() : void
        {
            NetDispatcher.addCmdListener(ServerCommand.HeroArenaGetToplistInfo, this.onGetToplistSuccHandler);
            return;
        }// end function

        private function removelisteners() : void
        {
            NetDispatcher.removeCmdListener(ServerCommand.HeroArenaGetToplistInfo, this.onGetToplistSuccHandler);
            return;
        }// end function

        private function onGetToplistSuccHandler(param1:Array) : void
        {
            var _loc_3:SArenaToplist = null;
            var _loc_4:DataProvider = null;
            var _loc_5:ArenaRankData = null;
            var _loc_6:SArenaBasePlayer = null;
            var _loc_2:Array = [];
            for each (_loc_3 in param1)
            {
                
                _loc_5 = new ArenaRankData();
                _loc_6 = _loc_3.playerInfo[0];
                _loc_5.rank = _loc_3.rank;
                if (_loc_6)
                {
                    _loc_5.vipState = _loc_6.vip;
                    _loc_5.roleName = _loc_6.name;
                    _loc_5.combat = _loc_6.combat;
                }
                _loc_5.point = _loc_3.mark;
                _loc_5.victoryRate = _loc_3.winPer;
                _loc_5.totalRank = _loc_3.crossRank;
                _loc_5.lastDaySettleNum = _loc_3.lastGoldNote;
                _loc_5.lastWeekSettlePack = _loc_3.lastWeekGift;
                _loc_2.push(_loc_5);
            }
            _loc_4 = new DataProvider();
            _loc_4.addItems(_loc_2);
            _rankList.dataProvider = _loc_4;
            _rankList.drawNow();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl();
            this.removelisteners();
            return;
        }// end function

    }
}
